{%include file="header.html"%}
<style>
  table{text-align: center;}
  th{text-align:center; font-weight: bolder;}
  th a{ color:#000000;}
.firtd {	width: 100px;	padding-right: 10px;	text-align: right;}
input {	width: 350px;}
textarea {	width: 350px;	height: 100px;}
</style>
<body>
<div class="fixed-bar">
  <div class="item-title">
    <h3>文章列表</h3>
    <select name="cat_id">
    	<option value="0">选择分类...</option>
    	{%$type%}
    </select>
    
    <input type="text" name="title" placeholder="输入文章名称" value="{%$smarty.get.title%}" style="width:125px; height:18px; margin-top:15px;" /> 
    <input value=" 搜索 " id="but_sousuo" style="width:40px; height:27px; margin-top:13px;" class="button" type="submit">
    
    <script>
    	$("#but_sousuo").click(function(){
			var cat_id=$("select[name=cat_id]").val();
			var title=$("input[name=title]").val();
			location.href="news_list.php?act=list&title="+title+"&cat_id="+cat_id;
		});
		
    </script>
    <div style="background:rgba(251,112,45,1);width:125px;height:40px;float:right;text-align:center;border-radius:5px;">
      <a href="news_list.php?act=add">
        <h5 style="padding:10px;color:#fff;">
          添加文章
        </h5>
      </a>
    </div>
  </div>
</div>
<div class="fixed_bottom">
  <form method="post" action="" id="aspnetForm" name="form1">
    <table align="center;" class="table tb-type2">
      <thead>
        <tr>
          <th><a>编号</a></th>
          <th><a>文章名称</a></th>
          <th><a>文章分类</a></th>
          <th><a>文章重要性</a></th>
          <th><a>是否显示</a></th>
          <th><a>添加日期</a></th>
          <th><a>操作</a></th>
        </tr>
      </thead>
      <tbody id="sortable">
        {%foreach from=$list item=list1 key=k%}
            <tr id="{%$list1.article_id%}" alt="{%$list1.article_id%}">
              <td>{%$list1.article_id%}</td>
              <td>{%$list1.title%}</td>
              <td>{%$list1.cat_name%}</td>
              <td>{%$list1.article_type%}</td>
              <td><i style="cursor:pointer;" onClick="get_show_price(this,{%$list1.article_id%},{%$list1.is_open%})" class="fa {%if $list1.is_open==1%}fa-check{%else%}fa-close{%/if%}"></i></td>
              <td><span>{%$list1.add_time|date_format:'%Y-%m-%d %H:%M:%I'%}</span></td>
              <td>
                <a href="news_list.php?act=add&article_id={%$list1.article_id%}">编辑</a>
                <a href="news_list.php?act=delete&article_id={%$list1.article_id%}">删除</a>
              </td>
            </tr>
        {%/foreach%}
        <input type="hidden" id="ids_list" />
      </tbody>
    </table>
    <div class="page">{%$page%}</div>
  </form>
</div>
</body>
<script>
//是否显示在导航栏 
function get_show_price(obj,id,price){
  if(price==1){
    prices="1";
  }else{
    prices="2";
  }
  $.post("news_list.php",{act:'show',article_id:id,zt:prices},function(data){
    if(data==1){
      layer.msg("操作成功！");
      if(prices==1){
        $(obj).attr("onclick","get_show_price(this,"+id+",2)");
        $(obj).removeClass("fa-check");
        $(obj).addClass("fa-close");
      }else if(prices==2){
        $(obj).attr("onclick","get_show_price(this,"+id+",1)");
        $(obj).removeClass("fa-close");
        $(obj).addClass("fa-check");
      }
    }else if(data==2){
      layer.msg("操作失败！");
    }
  })
}

</script>
</html>